home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Tools - Objects / MacApp / MacApp 2.0.1 / Experimental enhancements / MacApp Sizers / USizerView.p < prev    next >
Text File  |  1990-11-08  |  22KB  |  522 lines

  1. UNIT USizerView;
  2.  
  3. {    This unit implements views which can be divided into several resizable panes.
  4.     It also contains commands for resizing and splitting, as well as a splitter Control.
  5. }
  6.  
  7.     INTERFACE
  8.  
  9.         USES
  10.             UMacApp,
  11.             UArray,
  12.             Types, QuickDraw, ToolUtils, Packages,
  13.             FixMath;
  14.  
  15.         CONST
  16.  
  17.             { Command Numbers }
  18.  
  19.             cSizeViews            = 2300;                 { For resizing panes in TSizerView }
  20.  
  21.             { Miscellaneous }
  22.  
  23.             kSplitVertically    = v;                    { use with "whichWay" parameter of }
  24.             kSplitHorizontally    = h;                    { ISizerCommand }
  25.  
  26.             kSizerThickness     = 3;                    { default thickness of splitter bar }
  27.             kMinSizerPane        = 60;                    { default minimum pane size }
  28.  
  29.             kVertSizingCursor    = 1300;                 { CURSor IDs }
  30.             kHorzSizingCursor    = 1301;
  31.  
  32.             kGetMinCoord        = TRUE;                    { values for min parameter of GetSizerCoord }
  33.             kGetMaxCoord        = FALSE;
  34.  
  35.             kLocationVaries        = TRUE;                    { values for fLocDeterminer fields }
  36.             kLocationFixed        = FALSE;                { …of TSplitter }
  37.  
  38.             kStdSplitter        = 'splt';                { resource signature for a TSplitter }
  39.             kNoId                = '    ';                { empty view id }
  40.  
  41.  
  42.         TYPE
  43.  
  44.             VRectPtr    = ^VRect;
  45.             Coordinate    = (kLeftCoord, kRightCoord, kTopCoord, kBottomCoord);
  46.  
  47.             TVRectList            = OBJECT (TDynamicArray)
  48.             { This class represents an indexed list of VRects }
  49.  
  50.                 PROCEDURE TVRectList.IVRectList(initialSize: INTEGER);
  51.                 { Initialize the list, making it big enough to contain initialSize VRects. }
  52.  
  53.                 FUNCTION  TVRectList.At(index: ArrayIndex): VRect;
  54.                 { Return the VRect at the given list index. }
  55.  
  56.                 PROCEDURE TVRectList.AtPut(index: ArrayIndex; newItem: VRect);
  57.                 { Set the VRect at the specified index to the given VRect. If index is greater
  58.                   than the number of elements in the list, expand the list accordingly. }
  59.  
  60.                 PROCEDURE TVrectList.AtCoordPut(index: ArrayIndex; whichCoord: Coordinate;
  61.                                                 newCoord: VCoordinate);
  62.                 { Change a single coordinate of the specified VRect to the given value. }
  63.  
  64.                 PROCEDURE TVrectList.AtSetVRect(index: ArrayIndex; left, top, right, bottom: VCoordinate);
  65.                 { Change the specified VRect’s coordinates to the given values. }
  66.  
  67.                 PROCEDURE TVRectList.InsertBefore(index: ArrayIndex; item: VRect);
  68.  
  69.                 PROCEDURE TVRectList.Fields(PROCEDURE DoToField(fieldName: Str255;
  70.                                             fieldAddr: Ptr; fieldType: INTEGER)); OVERRIDE;
  71.  
  72.                 PROCEDURE TVRectList.DynamicFields(PROCEDURE DoToField(fieldName: Str255;
  73.                                             fieldAddr: Ptr; fieldType: integer)); OVERRIDE;
  74.  
  75.                 END;
  76.  
  77.     { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  78.  
  79.             TSizerView            = OBJECT (TView)
  80.             { This class maintains multiple panes (subviews of itself) with movable
  81.               sizer rectangles between them. }
  82.  
  83.                 fPanes:                TList;            { the subviews themselves }
  84.                 fSetbacks:            TVRectList;        { the setbacks for the subpanes }
  85.                 fSizerRects:         TVRectList;        { the sizer rectangles }
  86.                 fMinPaneSize:        VCoordinate;    { minimum width/height of a pane }
  87.                 fSizerThickness:    INTEGER;        { thickness of splitter }
  88.                 fSplitter:            TSplitter;        { NIL if no splitter }
  89.  
  90.                 { Initialization methods }
  91.  
  92.                 PROCEDURE TSizerView.Initialize; OVERRIDE;
  93.                 { Initialize fields to NIL. Called by IObject. }
  94.  
  95.                 PROCEDURE TSizerView.IRes(itsDocument: TDocument; itsSuperView: TView;
  96.                                                 VAR itsParams: Ptr); OVERRIDE;
  97.                 { Initialize a view created from templates. }
  98.  
  99.                 PROCEDURE TSizerView.ISizerView(itsDocument: TDocument;
  100.                                                 itsSuperview: TView;
  101.                                                 itsLocation: VPoint;
  102.                                                 itsSize: VPoint;
  103.                                                 itsHSizeDet, itsVSizeDet: SizeDeterminer);
  104.                 { Initialize a view created procedurally. }
  105.  
  106.                 PROCEDURE TSizerView.InitLists;
  107.                 { Create and initialize the various lists of subviews and VRects }
  108.  
  109.                 PROCEDURE TSizerView.FixupPanes(equalSpacing: BOOLEAN);
  110.                 { a/k/a “PostRes”: Call after IRes (NewTemplateWindow).
  111.                   Now that the subviews have been added, use them to initialize the
  112.                   setbacks and sizer rectangles to their default values.
  113.                   If equalSpacing is TRUE, make the panes of equal size;
  114.                   otherwise, try to locate the panes using their fLocations. }
  115.  
  116.                 PROCEDURE TSizerView.Free; OVERRIDE;
  117.                 { Free the setbacks and sizer list objects }
  118.  
  119.  
  120.                 { Adding, drawing, resizing panes }
  121.  
  122.                 PROCEDURE TSizerView.AddPane(newPane: TView; itsLocation: VCoordinate;
  123.                                              itsSetbacks: VRect);
  124.                 { Install thePane at the specified location, shrinking any existing pane
  125.                   accordingly. }
  126.  
  127.                 PROCEDURE TSizerView.AddEqualPane(newPane: TView; itsPosition: INTEGER;
  128.                                                   itsSetbacks: VRect);
  129.                 { Install thePane at the specified position, resizing all panes equally. }
  130.  
  131.                 FUNCTION  TSizerView.DeletePane(whichPane, whichSizer: INTEGER): TView;
  132.                 { Delete the specified pane and sizer; expand the remaining pane and
  133.                   return it. }
  134.  
  135.                 PROCEDURE TSizerView.Draw(area: Rect); OVERRIDE;
  136.                 { General draw method: call DrawSizerRect for each sizer rectangle. }
  137.  
  138.                 PROCEDURE TSizerView.DrawSizerRect(aRect: Rect);
  139.                 { Do the direction-dependent drawing: must be overridden. }
  140.  
  141.                 PROCEDURE TSizerView.InstallSetbacks(whichPane: INTEGER; itsSetbacks: VRect);
  142.                 { Use this method to set different setbacks than the default ones. }
  143.                 { This unit defines three global rects for use in setbacks:
  144.                     gVertSBarSetback - Use when installing scroller subviews which
  145.                         have only a vertical scrollbar.
  146.                     gHorzSBarSetback - Use when installing scroller subviews which
  147.                         have only a horizontal scrollbar.
  148.                     gBothSBarSetback - Use when installing scroller subviews which
  149.                         have horiz AND vert scrollbars.
  150.                   You may also use MacApp's gZeroVRect to indicate that there is to be
  151.                   no setback at all. }
  152.         
  153.                 FUNCTION  TSizerView.MergedSize(oldPane, changedPane: TView): VPoint;
  154.                 { Return the combined size of oldPane and changedPane. Must be overridden. }
  155.  
  156.                 PROCEDURE TSizerView.SetPane(whichSizer: INTEGER; itsSizerRect: VRect);
  157.                 { The specified sizer has moved, so adjust the panes on either side of it }
  158.  
  159.                 PROCEDURE TSizerView.SetPanes(newSizerRects: TVRectList;
  160.                                               invalidate: BOOLEAN);
  161.                 { All the sizers have moved, so adjust all the panes in the view }
  162.  
  163.                 PROCEDURE TSizerView.SuperViewChangedSize(delta: VPoint; invalidate: BOOLEAN); OVERRIDE;
  164.                 { Forces commit of any pending pane resize command. Generally this
  165.                   matters only on a window resize which normally would not commit a
  166.                   command; such a resize will force an additional pane resize so
  167.                   "Undo Pane Resize" (or Redo) ceases to make sense.}
  168.  
  169.  
  170.                 { Cursors and mice, etc. }
  171.  
  172.                 FUNCTION  TSizerView.DoMouseCommand(VAR theMouse: Point; VAR info: EventInfo;
  173.                                                     VAR hysteresis: Point): TCommand; OVERRIDE;
  174.                 { If the mouse is in a sizer rectangle, create and return a TSizerCommand. }
  175.  
  176.                 FUNCTION  TSizerView.DoSetCursor(localPoint: Point; cursorRgn: RgnHandle): BOOLEAN; OVERRIDE;
  177.                 { Draw the appropriate sizer cursor if necessary.  If the cursor resource
  178.                   is missing, default to the arrow. }
  179.  
  180.                 PROCEDURE TSizerView.InvalidateFocus; OVERRIDE;
  181.                 { Avoid traversing subviews; just set gFocusedView to NIL }
  182.  
  183.                 PROCEDURE TSizerView.TrackConstrain(anchorPoint, previousPoint: VPoint;
  184.                                                     VAR nextPoint: VPoint); OVERRIDE;
  185.                 { Constrain mouse tracking to my interior, allowing for the minimum pane size.
  186.                   Must be overridden: direction dependent. }
  187.  
  188.  
  189.                 { Gettors and settors }
  190.  
  191.                 FUNCTION  TSizerView.CompareViewLocations(view1, view2: TView): CompareResult;
  192.                 { Return the order of the two views by their location. This calculation
  193.                   is direction dependent, so it must be overridden. }
  194.  
  195.                 FUNCTION  TSizerView.FindPane(aView: TView): INTEGER;
  196.                 { Return the position (index) of aView in the fPanes list }
  197.  
  198.                 FUNCTION  TSizerView.FindPaneAt(theCoords: VPoint): TView;
  199.                 { Return the pane at the given coordinates }
  200.  
  201.                 FUNCTION  TSizerView.FindSizerPosition(VAR itsLocation: VCoordinate): INTEGER;
  202.                 { Given the desired coordinate for a new sizer rectangle, return its position
  203.                   (index) in the list of sizers, modifying itsLocation if necessary. }
  204.  
  205.                 FUNCTION  TSizerView.GetDefaultSizerRect(whichSizer: INTEGER): VRect;
  206.                 { Return the VRect for the given sizer, assuming evenly spaced sizers. }
  207.  
  208.                 FUNCTION  TSizerView.GetMinPaneLength: VCoordinate;
  209.                 { Return the minimum width/height of a pane of this view. }
  210.  
  211.                 FUNCTION  TSizerView.GetNextSizerRect(aPane: TView): VRect;
  212.                 { Must be overridden }
  213.  
  214.                 FUNCTION  TSizerView.GetNumberOfPanes: INTEGER;
  215.                 { How many subviews do I have? }
  216.  
  217.                 FUNCTION  TSizerView.GetNumberOfSizers: INTEGER;
  218.                 { How many sets of sizer bars do I have? (Hint: number of panes - 1) }
  219.  
  220.                 FUNCTION  TSizerView.GetSizerCoord(whichSizer: INTEGER; min: BOOLEAN): VCoordinate;
  221.                 { Return the left/top (min=T) or right/bottom (min=F) coordinate of the
  222.                     specified sizer rect.
  223.                   If whichSizer is larger than the number of sizers, return the width/height
  224.                     of the view.
  225.                   If whichSizer is 0, return 0. }
  226.  
  227.                 FUNCTION  TSizerView.GetSizerRect(whichSizer: INTEGER): VRect;
  228.                 { Return the specified sizer rectangle. The count starts from the
  229.                   top/left at 1. }
  230.  
  231.                 FUNCTION  TSizerView.GetSizerThickness: INTEGER;
  232.                 { Return the thickness of the pane splitter rectangle. }
  233.  
  234.                 FUNCTION  TSizerView.GetSizingCursor: INTEGER;
  235.                 { Return the resource id of the cursor to use when sizing.
  236.                   Must be overridden. }
  237.  
  238.                 FUNCTION  TSizerView.GetSplitDirection: VHSelect;
  239.                 { Return the direction of the split: v or h. Defaults to h. }
  240.  
  241.                 FUNCTION  TSizerView.IsPointInSizer(localPoint: Point): INTEGER;
  242.                 { Return the number of the sizer rect the localPoint is in, or 0 if none. }
  243.  
  244.                 FUNCTION  TSizerView.IsValidSplitPt(aPoint: VPoint): BOOLEAN;
  245.                 { Return TRUE if the pane can be split at the given location. }
  246.  
  247.                 FUNCTION  TSizerView.MakeSizerRect(itsLocation: VCoordinate): VRect;
  248.                 { Direction-dependent: must be overridden }
  249.  
  250.                 PROCEDURE TSizerView.SetMinPaneLength(minLength: VCoordinate);
  251.                 { Set the minimum width/height of a pane of this view. }
  252.  
  253.                 PROCEDURE TSizerView.SetSizerThickness(thickness: INTEGER);
  254.                 { Set the thickness of the pane splitter rectangle. }
  255.  
  256.                 PROCEDURE TSizerView.SetSizerRect(whichSizer: INTEGER; itsSizerRect: VRect);
  257.                 { Change the specified sizerRect and invalidate both the old and new rectangles. }
  258.  
  259.                 PROCEDURE TSizerView.Fields(PROCEDURE
  260.                                             DoToField(fieldName: Str255; fieldAddr: Ptr;
  261.                                                       fieldType: INTEGER)); OVERRIDE;
  262.                 END;
  263.  
  264.             THorizontalSizer    = OBJECT (TSizerView)
  265.             { This view contains subviews which are stacked one on top of the other. }
  266.  
  267.                 FUNCTION  THorizontalSizer.CompareViewLocations(view1, view2: TView): CompareResult; OVERRIDE;
  268.                 { Tell whether view1 is above or below view2, by location. }
  269.  
  270.                 PROCEDURE THorizontalSizer.DrawSizerRect(aRect: Rect); OVERRIDE;
  271.                 { Draw two parallel horizontal lines to represent the sizer rectangle. }
  272.  
  273.                 FUNCTION  THorizontalSizer.GetNextSizerRect(aPane: TView): VRect; OVERRIDE;
  274.  
  275.                 FUNCTION  THorizontalSizer.GetSizerCoord(whichSizer: INTEGER;
  276.                                                          min: BOOLEAN): VCoordinate; OVERRIDE;
  277.  
  278.                 FUNCTION  THorizontalSizer.GetSizerRect(whichSizer: INTEGER): VRect; OVERRIDE;
  279.  
  280.                 FUNCTION  THorizontalSizer.GetSizingCursor: INTEGER; OVERRIDE;
  281.                 { Return the resource id of the cursor to display when it's over horizontal
  282.                   sizer bars. }
  283.  
  284.                 FUNCTION  THorizontalSizer.IsValidSplitPt(aPoint: VPoint): BOOLEAN; OVERRIDE;
  285.  
  286.                 FUNCTION  THorizontalSizer.MakeSizerRect(itsLocation: VCoordinate): VRect; OVERRIDE;
  287.                 { Return the sizer VRect with the specified top coordinate. }
  288.  
  289.                 PROCEDURE THorizontalSizer.Resize(width, height: VCoordinate; invalidate: BOOLEAN); OVERRIDE;
  290.                 { Resize the panes proportionally. }
  291.  
  292.                 PROCEDURE THorizontalSizer.SetPane(whichSizer: INTEGER; itsSizerRect: VRect); OVERRIDE;
  293.                 PROCEDURE THorizontalSizer.SetPanes(newSizerRects: TVRectList; invalidate: BOOLEAN); OVERRIDE;
  294.                 { Direction-dependent resizing. See description in the parent class. }
  295.  
  296.                 PROCEDURE THorizontalSizer.TrackConstrain(anchorPoint, previousPoint: VPoint;
  297.                                                           VAR nextPoint: VPoint); OVERRIDE;
  298.                 { Constrain mouse tracking to my interior, allowing for the minimum pane size }
  299.  
  300.                 END;
  301.  
  302.             TVerticalSizer    = OBJECT (TSizerView)
  303.             { This view contains panes which are positioned side-by-side, separated by
  304.               vertical bars. }
  305.  
  306.                 FUNCTION  TVerticalSizer.CompareViewLocations(view1, view2: TView): CompareResult; OVERRIDE;
  307.                 { Tell whether view1 is before or after view2, by location. }
  308.  
  309.                 PROCEDURE TVerticalSizer.DrawSizerRect(aRect: Rect); OVERRIDE;
  310.                 { Draw two parallel vertical lines to represent the sizer rectangle. }
  311.  
  312.                 FUNCTION  TVerticalSizer.GetNextSizerRect(aPane: TView): VRect; OVERRIDE;
  313.  
  314.                 FUNCTION  TVerticalSizer.GetSizerCoord(whichSizer: INTEGER;
  315.                                                        min: BOOLEAN): VCoordinate; OVERRIDE;
  316.  
  317.                 FUNCTION  TVerticalSizer.GetSizerRect(whichSizer: INTEGER): VRect; OVERRIDE;
  318.  
  319.                 FUNCTION  TVerticalSizer.GetSizingCursor: INTEGER; OVERRIDE;
  320.                 { Return the resource id of the cursor to display when it's over vertical
  321.                   sizer bars. }
  322.  
  323.                 FUNCTION  TVerticalSizer.GetSplitDirection: VHSelect; OVERRIDE;
  324.                 { Return the direction of the split: v. }
  325.  
  326.                 FUNCTION  TVerticalSizer.IsValidSplitPt(aPoint: VPoint): BOOLEAN; OVERRIDE;
  327.  
  328.                 FUNCTION  TVerticalSizer.MakeSizerRect(itsLocation: VCoordinate): VRect; OVERRIDE;
  329.                 { Return the sizer VRect with the specified left coordinate. }
  330.  
  331.                 PROCEDURE TVerticalSizer.Resize(width, height: VCoordinate; invalidate: BOOLEAN); OVERRIDE;
  332.                 { Resize the panes proportionally. }
  333.  
  334.                 PROCEDURE TVerticalSizer.SetPane(whichSizer: INTEGER; itsSizerRect: VRect); OVERRIDE;
  335.                 PROCEDURE TVerticalSizer.SetPanes(newSizerRects: TVRectList; invalidate: BOOLEAN); OVERRIDE;
  336.                 { Direction-dependent resizing. See description in the parent class. }
  337.  
  338.                 PROCEDURE TVerticalSizer.TrackConstrain(anchorPoint, previousPoint: VPoint;
  339.                                                         VAR nextPoint: VPoint); OVERRIDE;
  340.                 { Constrain mouse tracking to my interior, allowing for the minimum pane size }
  341.  
  342.                 END;
  343.  
  344.     { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  345.  
  346.             TSizerCommand        = OBJECT (TCommand)
  347.             { This command is for moving existing sizer bars, resizing the panes they separate. }
  348.  
  349.                 fSizerView:         TSizerView;            { view in which to track sizers }
  350.                 fNewEdge:            LONGINT;            { the new sizer rectangle location }
  351.                 fOldSizerRect:        VRect;                { the old sizer rectangle }
  352.                 fSplitDir:            VHSelect;            { direction of the split: h or v }
  353.                 fWhichSizer:        INTEGER;            { which sizer we’re tracking, }
  354.                                                         { …counting from the left or top }
  355.  
  356.                 PROCEDURE TSizerCommand.ISizerCommand(itsSizerView: TSizerView;
  357.                                                       whichSizer: INTEGER; whichWay: VHSelect);
  358.                 { Add whichWay parameter so command doesn’t have to do a Member test on the
  359.                   sizer view }
  360.  
  361.                 FUNCTION  TSizerCommand.TrackMouse(aTrackPhase: TrackPhase; VAR anchorPoint,
  362.                                                   previousPoint, nextPoint: VPoint;
  363.                                                   mouseDidMove: BOOLEAN): TCommand; OVERRIDE;
  364.  
  365.                 PROCEDURE TSizerCommand.TrackFeedback(anchorPoint, nextPoint: VPoint; turnItOn,
  366.                                                       mouseDidMove: BOOLEAN); OVERRIDE;
  367.  
  368.                 PROCEDURE TSizerCommand.TrackConstrain(anchorPoint, previousPoint: VPoint;
  369.                                                        VAR nextPoint: VPoint); OVERRIDE;
  370.  
  371.                 PROCEDURE TSizerCommand.DoIt; OVERRIDE;
  372.                 { Compute the new sizer rectangle and resize the appropriate panes }
  373.  
  374.                 PROCEDURE TSizerCommand.UndoIt; OVERRIDE;
  375.                 { Set sizer rectangle back to its previous location, and resize panes }
  376.  
  377.                 PROCEDURE TSizerCommand.RedoIt; OVERRIDE;
  378.                 { DoIt again }
  379.  
  380.                 PROCEDURE TSizerCommand.SetPenForFeedback(aPoint: VPoint);
  381.                 { Set the pen pattern and size for showing feedback when tracking at the
  382.                   given point }
  383.  
  384.                 PROCEDURE TSizerCommand.Fields(PROCEDURE
  385.                                                DoToField(fieldName: Str255; fieldAddr: Ptr;
  386.                                                          fieldType: INTEGER)); OVERRIDE;
  387.  
  388.                 END;                                    { TSizerCommand }
  389.  
  390.     { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  391.  
  392.             TSplitterCommand    = OBJECT (TSizerCommand)
  393.             { This command is for creating new sizer bars using a splitter control. The pane
  394.               split by the new sizer is cloned, creating a new subview of the SizerView. }
  395.  
  396.                 PROCEDURE TSplitterCommand.ISplitterCommand(itsSizerView: TSizerView);
  397.                 { Set fWhichSizer to 0, so that it tracks over the entire SizerView. }
  398.  
  399.                 PROCEDURE TSplitterCommand.TrackConstrain(anchorPoint, previousPoint: VPoint;
  400.                                                           VAR nextPoint: VPoint); OVERRIDE;
  401.                 { Override to do nothing, so that tracking will be constrained to the SizerView }
  402.  
  403.                 PROCEDURE TSplitterCommand.DoIt; OVERRIDE;
  404.                 { Create the new pane via cloning and add it to the SizerView. }
  405.  
  406.                 PROCEDURE TSplitterCommand.SetPenForFeedback(aPoint: VPoint); OVERRIDE;
  407.                 { Show a gray line when tracking outside areas where splitting is allowed. }
  408.  
  409.                 FUNCTION  TSplitterCommand.TrackMouse(aTrackPhase: TrackPhase;
  410.                                                       VAR anchorPoint, previousPoint, nextPoint: VPoint;
  411.                                                       mouseDidMove: BOOLEAN): TCommand; OVERRIDE;
  412.                 { If the pane is not splittable at the mouse-up location, return NIL. }
  413.  
  414.                 PROCEDURE TSplitterCommand.Fields(PROCEDURE DoToField(fieldName: Str255; fieldAddr: Ptr;
  415.                                             fieldType: INTEGER)); OVERRIDE;
  416.  
  417.                 END;
  418.             
  419.     { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  420.  
  421.             SizerTracking = (kResizeOK, kResizeNotOK, kDeleteSizer);
  422.  
  423.             TDeSizerCommand        = OBJECT (TSizerCommand)
  424.             { This command is for moving or deleting existing sizer bars.
  425.               The SizerView must contain a splitter control. }
  426.  
  427.                 fResizeRect:        VRect;            { valid area for resizing }
  428.                 fResizeOK:            BOOLEAN;        { characterize area of fSizerView… }
  429.                                                     { …we're tracking in }
  430.  
  431.                 PROCEDURE TDeSizerCommand.IDeSizerCommand(itsSizerView: TSizerView; whichSizer: INTEGER;
  432.                                                           whichWay: VHSelect);
  433.  
  434.                 PROCEDURE TDeSizerCommand.DoIt; OVERRIDE;
  435.                 { If final mouse position was at either end of the SizerView,
  436.                   delete the sizer bars; otherwise, just resize. }
  437.  
  438.                 PROCEDURE TDeSizerCommand.SetPenForFeedback(aPoint: VPoint); OVERRIDE;
  439.                 { Set the pen to black, gray, or white, depending on where aPoint is. }
  440.  
  441.                 PROCEDURE TDeSizerCommand.TrackConstrain(anchorPoint, previousPoint: VPoint;
  442.                                             VAR nextPoint: VPoint); OVERRIDE;
  443.                 { Track over the entire SizerView, but keep track of whether nextPoint
  444.                   is a valid spot for the sizer bars to move to. }
  445.  
  446.                 FUNCTION  TDeSizerCommand.TrackMouse(aTrackPhase: TrackPhase; VAR anchorPoint,
  447.                                                      previousPoint, nextPoint: VPoint;
  448.                                                      mouseDidMove: BOOLEAN): TCommand; OVERRIDE;
  449.                 { Return NIL if trackRelease is in original sizer rect, or if trackRelease
  450.                   is outside the valid resizing area (but not in the sizer deletion area). }
  451.  
  452.                 PROCEDURE TDeSizerCommand.Fields(PROCEDURE DoToField(fieldName: Str255;
  453.                                                                      fieldAddr: Ptr;
  454.                                                                      fieldType: INTEGER)); OVERRIDE;
  455.                 END;
  456.  
  457.     { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  458.  
  459.             TSplitter    = OBJECT (TControl)
  460.  
  461.                 fSizerView:            TSizerView;        { the view that handles multiple panes }
  462.                 fLocDeterminer:        ARRAY[VHSelect] OF BOOLEAN;    { T: adjust location coordinate }
  463.                                                     { …in SuperViewChangedSize }
  464.  
  465.                 PROCEDURE TSplitter.IRes(itsDocument: TDocument; itsSuperView: TView;
  466.                                          VAR itsParams: Ptr); OVERRIDE;
  467.  
  468.                 PROCEDURE TSplitter.ISplitter(itsDocument: TDocument; itsSuperview: TView;
  469.                                               itsLocation: VPoint; itsSize: VPoint);
  470.  
  471.                 PROCEDURE TSplitter.IFinish(itsSuperView: TView);
  472.                 { Finish up initialization by setting the fSizerView and fLocDeterminer fields.
  473.                   The latter are determined by the SizerView’s split direction. }
  474.  
  475.                 PROCEDURE TSplitter.Draw(area: Rect); OVERRIDE;
  476.                 { Default is just a black rectangle, like a splitter well }
  477.  
  478.                 FUNCTION  TSplitter.DoMouseCommand(VAR theMouse: Point; VAR info: EventInfo;
  479.                                                    VAR hysteresis: Point): TCommand; OVERRIDE;
  480.                 { Override to return a TSplitterCommand. }
  481.  
  482.                 FUNCTION  TSplitter.GetThickness: LONGINT;
  483.                 { Return the thickness of the splitter control. }
  484.  
  485.                 PROCEDURE TSplitter.SuperViewChangedSize(delta: VPoint; invalidate: BOOLEAN); OVERRIDE;
  486.                 { Adjust the coordinates for which fLocDeterminer = T }
  487.  
  488.                 PROCEDURE TSplitter.Fields(PROCEDURE DoToField(fieldName: Str255; fieldAddr: Ptr;
  489.                                                fieldType: INTEGER)); OVERRIDE;
  490.  
  491.                 END;
  492.  
  493.     { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
  494.  
  495.         VAR
  496.             gVertSBarSetback:    VRect;                    { Use when installing scroller subviews which
  497.                                                           have only a vertical scrollbar }
  498.             gHorzSBarSetback:    VRect;                    { Use when installing scroller subviews which
  499.                                                           have only a horizontal scrollbar }
  500.             gBothSBarSetback:    VRect;                    { Use when installing scroller subviews which
  501.                                                           have horiz AND vert scrollbars }
  502.  
  503.             gNonPanes:            TIntegerArray;            { list of ids of classes that may not be panes }
  504.  
  505.  
  506.         PROCEDURE InitUSizerView;
  507.         { Initializes utility VRects and registers TSizerView }
  508.  
  509.         FUNCTION  CloneAView(aView: TView): TView;
  510.         { Clone aView and all its subviews }
  511.  
  512.         PROCEDURE ExcludeAsPane(obj: TObject);
  513.         { Make the class of obj ineligible for pane-dom (i.e., add the class id of obj
  514.           to the gNonPanes list). }
  515.  
  516.  
  517.     IMPLEMENTATION
  518.  
  519.         {$I USizerView.impl.p}
  520.  
  521. END.
  522.